package com.example.demo.service;

import com.example.demo.mode.PrintFileOperation;
import com.example.demo.repository.PrintFileOperationsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 21024
 */
@Service
public class PrintFileOperationHistoryService {
    private final PrintFileOperationsMapper printFileOperationsMapper;

    @Autowired
    public PrintFileOperationHistoryService(PrintFileOperationsMapper printFileOperationsMapper) {
        this.printFileOperationsMapper = printFileOperationsMapper;
    }

    public List<PrintFileOperation> findByFileName(String fileName, int pageNum, int pageSize) {
        return printFileOperationsMapper.findByFileName(fileName, (pageNum - 1) * pageSize, pageSize);
    }

    public int countByFileName(String fileName) {
        return printFileOperationsMapper.countByFileName(fileName);
    }

    public List<PrintFileOperation> findAllFileName(String fileName) {
        return printFileOperationsMapper.findAllFileName(fileName);
    }
}
